<!doctype html>



  


<html class="theme-next mist use-motion" lang="zh-Hans">
<head>
  <meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>






<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />















  
  
  <link href="/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css" />




  
  
  
  

  
    
    
  

  

  

  

  

  
    
    
    <link href="//fonts.googleapis.com/css?family=Lato:300,300italic,400,400italic,700,700italic&subset=latin,latin-ext" rel="stylesheet" type="text/css">
  






<link href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css" />

<link href="/css/main.css?v=5.1.0" rel="stylesheet" type="text/css" />


  <meta name="keywords" content="Docker,Openvpn," />








  <link rel="shortcut icon" type="image/x-icon" href="/favicon.ico?v=5.1.0" />






<meta name="description" content="概述：管理复杂网络内的系统,有时候需要突破网络限制.有比较多的方案,比如ss5,Shadowsocks,vpn等.这里提供一种方案是利用docker-openvpn实施多重复杂网络内的主机互联,实现利用nginx反向代理各类服务. 概念图：  具体流程： 购买云服务器部署docker建议购买支持systemctl的Linux系统,比较好管理,并部署docker:  外挂存储格式化为xfs分区;12">
<meta name="keywords" content="Docker,Openvpn">
<meta property="og:type" content="article">
<meta property="og:title" content="跨城区局域网的搭建（基于Docker）">
<meta property="og:url" content="https://blog.mickeyzzc.tech/2017/01/20/mi-docker-net/index.html">
<meta property="og:site_name" content="MickeyBee's BLOG">
<meta property="og:description" content="概述：管理复杂网络内的系统,有时候需要突破网络限制.有比较多的方案,比如ss5,Shadowsocks,vpn等.这里提供一种方案是利用docker-openvpn实施多重复杂网络内的主机互联,实现利用nginx反向代理各类服务. 概念图：  具体流程： 购买云服务器部署docker建议购买支持systemctl的Linux系统,比较好管理,并部署docker:  外挂存储格式化为xfs分区;12">
<meta property="og:image" content="https://blog.mickeyzzc.tech/images/private_docker_net.png">
<meta property="og:image" content="https://blog.mickeyzzc.tech/images/proxy_stream.png">
<meta property="og:updated_time" content="2017-02-27T15:20:21.000Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="跨城区局域网的搭建（基于Docker）">
<meta name="twitter:description" content="概述：管理复杂网络内的系统,有时候需要突破网络限制.有比较多的方案,比如ss5,Shadowsocks,vpn等.这里提供一种方案是利用docker-openvpn实施多重复杂网络内的主机互联,实现利用nginx反向代理各类服务. 概念图：  具体流程： 购买云服务器部署docker建议购买支持systemctl的Linux系统,比较好管理,并部署docker:  外挂存储格式化为xfs分区;12">
<meta name="twitter:image" content="https://blog.mickeyzzc.tech/images/private_docker_net.png">



<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Mist',
    sidebar: {"position":"left","display":"post","offset":12,"offset_float":0,"b2t":false,"scrollpercent":false},
    fancybox: true,
    motion: true,
    duoshuo: {
      userId: 'squall_zzc',
      author: '博主'
    },
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>



  <link rel="canonical" href="https://blog.mickeyzzc.tech/2017/01/20/mi-docker-net/"/>





  <title>跨城区局域网的搭建（基于Docker） | MickeyBee's BLOG</title>
</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-Hans">

  




<script>
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
            (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
          m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
  ga('create', 'UA-97893934-1', 'auto');
  ga('send', 'pageview');
</script>


  <script type="text/javascript">
    var _hmt = _hmt || [];
    (function() {
      var hm = document.createElement("script");
      hm.src = "https://hm.baidu.com/hm.js?ebd237aaca3280d73b83afa3d7327f59";
      var s = document.getElementsByTagName("script")[0];
      s.parentNode.insertBefore(hm, s);
    })();
  </script>










  
  
    
  

  <div class="container sidebar-position-left page-post-detail ">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">
    

    <div class="custom-logo-site-title">
      <a href="/"  class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">MickeyBee's BLOG</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
      
        <h1 class="site-subtitle" itemprop="description">Mickey & Bee</h1>
      
  </div>

  <div class="site-nav-toggle">
    <button>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br />
            
            首页
          </a>
        </li>
      
        
        <li class="menu-item menu-item-categories">
          <a href="/categories" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-th"></i> <br />
            
            分类
          </a>
        </li>
      
        
        <li class="menu-item menu-item-about">
          <a href="/about" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-user"></i> <br />
            
            关于
          </a>
        </li>
      
        
        <li class="menu-item menu-item-archives">
          <a href="/archives" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-archive"></i> <br />
            
            归档
          </a>
        </li>
      
        
        <li class="menu-item menu-item-tags">
          <a href="/tags" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-tags"></i> <br />
            
            标签
          </a>
        </li>
      
        
        <li class="menu-item menu-item-commonweal">
          <a href="/404.html" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-question-circle"></i> <br />
            
            公益404
          </a>
        </li>
      

      
    </ul>
  

  
</nav>



 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  <article class="post post-type-normal " itemscope itemtype="http://schema.org/Article">
    <link itemprop="mainEntityOfPage" href="https://blog.mickeyzzc.tech/2017/01/20/mi-docker-net/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="蓝宝石的傻话">
      <meta itemprop="description" content="">
      <meta itemprop="image" content="/images/avatar.gif">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="MickeyBee's BLOG">
    </span>

    
      <header class="post-header">

        
        
          <h2 class="post-title" itemprop="name headline">
            
            
              
                跨城区局域网的搭建（基于Docker）
              
            
          </h2>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              
              <time title="创建于" itemprop="dateCreated datePublished" datetime="2017-01-20T04:20:21+08:00">
                2017-01-20
              </time>
            

            

            
          </span>

          
            <span class="post-category" >
            
              <span class="post-meta-divider">|</span>
            
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              
                <span class="post-meta-item-text">分类于</span>
              
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/Docker/" itemprop="url" rel="index">
                    <span itemprop="name">Docker</span>
                  </a>
                </span>

                
                
              
            </span>
          

          
            
              <span class="post-comments-count">
                <span class="post-meta-divider">|</span>
                <span class="post-meta-item-icon">
                  <i class="fa fa-comment-o"></i>
                </span>
                <a href="/2017/01/20/mi-docker-net/#comments" itemprop="discussionUrl">
                  <span class="post-comments-count ds-thread-count" data-thread-key="2017/01/20/mi-docker-net/" itemprop="commentCount"></span>
                </a>
              </span>
            
          

          
          

          

          

          

        </div>
      </header>
    

    <div class="post-body" itemprop="articleBody">

      
      

      
        <h3 id="概述："><a href="#概述：" class="headerlink" title="概述："></a>概述：</h3><p>管理复杂网络内的系统,有时候需要突破网络限制.有比较多的方案,比如ss5,Shadowsocks,vpn等.<br>这里提供一种方案是利用<a href="https://hub.docker.com/r/kylemanna/openvpn/" target="_blank" rel="external">docker-openvpn</a><br>实施多重复杂网络内的主机互联,实现利用nginx反向代理各类服务.</p>
<h3 id="概念图："><a href="#概念图：" class="headerlink" title="概念图："></a>概念图：</h3><p><img src="/images/private_docker_net.png" alt=""></p>
<p><img src="/images/proxy_stream.png" alt=""></p>
<h3 id="具体流程："><a href="#具体流程：" class="headerlink" title="具体流程："></a>具体流程：</h3><ul>
<li><h4 id="购买云服务器部署docker"><a href="#购买云服务器部署docker" class="headerlink" title="购买云服务器部署docker"></a>购买云服务器部署docker</h4><p>建议购买支持systemctl的Linux系统,比较好管理,并部署docker:</p>
<ol>
<li><h5 id="外挂存储格式化为xfs分区"><a href="#外挂存储格式化为xfs分区" class="headerlink" title="外挂存储格式化为xfs分区;"></a>外挂存储格式化为xfs分区;</h5><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line"># mkfs.xfs /dev/vdb5</div><div class="line"># echo &quot;/dev/vdb5 /mnt/data xfs defaults 1 1&quot; |tee -a /etc/fstab</div></pre></td></tr></table></figure>
</li>
<li><h5 id="调整docker的目录-两种方法"><a href="#调整docker的目录-两种方法" class="headerlink" title="调整docker的目录,两种方法;"></a>调整docker的目录,两种方法;</h5><ul>
<li><p>挂载/var/lib/docker目录:</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div></pre></td><td class="code"><pre><div class="line"># systemctl stop docker</div><div class="line"># mkdir -p /mnt/data/docker</div><div class="line"># rsync -aXS /var/lib/docker/.  /mnt/data/docker/</div><div class="line"># echo &quot;/mnt/data/docker /var/lib/docker none bind 0 0&quot;|tee -a /etc/fstab</div><div class="line"># mount -a</div><div class="line"># systemctl start docker</div></pre></td></tr></table></figure>
</li>
<li><p>指定具体目录:<br>在/etc/systemd/system/multi-user.target.wants/docker.service里面修改如下:</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">ExecStart=/usr/bin/dockerd --storage-driver=overlay2 -g /mnt/hhd/docker</div></pre></td></tr></table></figure>
</li>
</ul>
</li>
</ol>
</li>
<li><h4 id="安装docker-openvpn服务"><a href="#安装docker-openvpn服务" class="headerlink" title="安装docker-openvpn服务:"></a>安装<a href="https://hub.docker.com/r/kylemanna/openvpn/" target="_blank" rel="external">docker-openvpn</a>服务:</h4><ul>
<li><h5 id="Pick-a-name-for-the-OVPN-DATA-data-volume-container-it-will-be-created-automatically"><a href="#Pick-a-name-for-the-OVPN-DATA-data-volume-container-it-will-be-created-automatically" class="headerlink" title="Pick a name for the $OVPN_DATA data volume container, it will be created automatically."></a>Pick a name for the $OVPN_DATA data volume container, it will be created automatically.</h5><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line"># OVPN_DATA=&quot;ovpn-data&quot;</div></pre></td></tr></table></figure>
</li>
<li><h5 id="Initialize-the-OVPN-DATA-container-that-will-hold-the-configuration-files-and-certificates"><a href="#Initialize-the-OVPN-DATA-container-that-will-hold-the-configuration-files-and-certificates" class="headerlink" title="Initialize the $OVPN_DATA container that will hold the configuration files and certificates"></a>Initialize the $OVPN_DATA container that will hold the configuration files and certificates</h5><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div></pre></td><td class="code"><pre><div class="line"># docker volume create --name $OVPN_DATA</div><div class="line"># docker run -v $OVPN_DATA:/etc/openvpn \</div><div class="line">  --rm kylemanna/openvpn ovpn_genconfig \</div><div class="line">  -u udp://VPN.SERVERNAME.COM</div><div class="line"># docker run -v $OVPN_DATA:/etc/openvpn \</div><div class="line">  --rm -it kylemanna/openvpn ovpn_initpki</div></pre></td></tr></table></figure>
<p>如果使用tcp</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div></pre></td><td class="code"><pre><div class="line"># docker run -v $OVPN_DATA:/etc/openvpn \</div><div class="line">  --rm kylemanna/openvpn ovpn_genconfig \</div><div class="line">  -u tcp://VPN.SERVERNAME.COM:1443</div></pre></td></tr></table></figure>
</li>
<li><h5 id="Start-OpenVPN-server-process"><a href="#Start-OpenVPN-server-process" class="headerlink" title="Start OpenVPN server process"></a>Start OpenVPN server process</h5><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div></pre></td><td class="code"><pre><div class="line"># docker run -v $OVPN_DATA:/etc/openvpn -d \</div><div class="line">  -p 1194:1194/udp \</div><div class="line">  --cap-add=NET_ADMIN kylemanna/openvpn</div></pre></td></tr></table></figure>
<p>OR</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div></pre></td><td class="code"><pre><div class="line"># docker run -v $OVPN_DATA:/etc/openvpn -d \</div><div class="line">  -p 1443:1194/tcp \</div><div class="line">  --cap-add=NET_ADMIN kylemanna/openvpn</div></pre></td></tr></table></figure>
<p>Running a Second Fallback TCP Container</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div></pre></td><td class="code"><pre><div class="line"># docker run -v $OVPN_DATA:/etc/openvpn \</div><div class="line">  --rm -p 1443:1194/tcp \</div><div class="line">  --privileged kylemanna/openvpn ovpn_run \</div><div class="line">  --proto tcp</div></pre></td></tr></table></figure>
</li>
<li><h5 id="Generate-a-client-certificate-without-a-passphrase"><a href="#Generate-a-client-certificate-without-a-passphrase" class="headerlink" title="Generate a client certificate without a passphrase ."></a>Generate a client certificate without a passphrase .</h5><p>Retrieve the client configuration with embedded certificates,  “CLIENTNAME”可自定义;</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div></pre></td><td class="code"><pre><div class="line"># docker run -v $OVPN_DATA:/etc/openvpn \</div><div class="line">  --rm -it kylemanna/openvpn easyrsa build-client-full CLIENTNAME nopass</div><div class="line"># docker run -v $OVPN_DATA:/etc/openvpn \</div><div class="line">  --rm kylemanna/openvpn ovpn_getclient CLIENTNAME &gt; CLIENTNAME.ovpn</div></pre></td></tr></table></figure>
</li>
<li><h5 id="增加路由规则"><a href="#增加路由规则" class="headerlink" title="增加路由规则"></a>增加路由规则</h5><p>在docker主机上增加一条路由规则,目的是使其他容器可以通过默认的网络来访问到openvpn客户端的节点:</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line"># ip route add 192.168.255.0/24 via $DOCKER_OPENVPN_IP</div></pre></td></tr></table></figure>
</li>
<li><h5 id="给客户端配置静态内外IP。"><a href="#给客户端配置静态内外IP。" class="headerlink" title="给客户端配置静态内外IP。"></a>给客户端配置静态内外IP。</h5><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line"># cat ccd/CLIENTNAME</div><div class="line">ifconfig-push 192.168.255.10 192.168.255.9</div></pre></td></tr></table></figure>
</li>
</ul>
</li>
<li><h4 id="部署前端代理"><a href="#部署前端代理" class="headerlink" title="部署前端代理"></a>部署前端代理</h4><ul>
<li><h5 id="选择DOCKER-CADDY做反向代理"><a href="#选择DOCKER-CADDY做反向代理" class="headerlink" title="选择DOCKER-CADDY做反向代理:"></a>选择<a href="https://hub.docker.com/r/abiosoft/caddy/" target="_blank" rel="external">DOCKER-CADDY</a>做反向代理:</h5><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div></pre></td><td class="code"><pre><div class="line">docker run -d \</div><div class="line">  -v $(pwd)/Caddyfile:/etc/Caddyfile \</div><div class="line">  -v $HOME/.caddy:/root/.caddy \</div><div class="line">  -p 80:80 -p 443:443 \</div><div class="line">  --name caddy \</div><div class="line">  --link openvpn:openvpn \</div><div class="line">  abiosoft/caddy</div></pre></td></tr></table></figure>
</li>
<li><h5 id="CADDY的配置参考："><a href="#CADDY的配置参考：" class="headerlink" title="CADDY的配置参考："></a>CADDY的配置参考：</h5><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div></pre></td><td class="code"><pre><div class="line">http://git.mickeybee.cn &#123;</div><div class="line">  redir https://git.mickeybee.cn&#123;url&#125;</div><div class="line">&#125;</div><div class="line">https://git.mickeybee.cn &#123;</div><div class="line">  gzip</div><div class="line">  proxy / 192.168.xxx.xx:3000</div><div class="line">  tls xxx@xxx.com &#123;</div><div class="line">    max_certs 10</div><div class="line">    key_type  p256</div><div class="line">  &#125;</div><div class="line">&#125;</div></pre></td></tr></table></figure>
</li>
</ul>
</li>
<li><h4 id="部署TCP代理"><a href="#部署TCP代理" class="headerlink" title="部署TCP代理"></a>部署TCP代理</h4><ul>
<li><h5 id="选择DOCKER-HAPROXY并部署"><a href="#选择DOCKER-HAPROXY并部署" class="headerlink" title="选择DOCKER-HAPROXY并部署:"></a>选择<a href="https://hub.docker.com/_/haproxy/" target="_blank" rel="external">DOCKER-HAPROXY</a>并部署:</h5><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div></pre></td><td class="code"><pre><div class="line">docker run -d \</div><div class="line">  -v $(pwd)/haproxy:/usr/local/etc/haproxy:ro \</div><div class="line">  -p xxx:xxx -p yyy:yyy \</div><div class="line">  --name haproxy \</div><div class="line">  --link openvpn:openvpn \</div><div class="line">  haproxy</div></pre></td></tr></table></figure>
</li>
<li><h4 id="映射后端端口。"><a href="#映射后端端口。" class="headerlink" title="映射后端端口。"></a>映射后端端口。</h4></li>
</ul>
</li>
</ul>

      
    </div>

    <div>
      
        

      
    </div>

    <div>
      
        

      
    </div>

    <div>
      
        

      
    </div>

    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/tags/Docker/" rel="tag"># Docker</a>
          
            <a href="/tags/Openvpn/" rel="tag"># Openvpn</a>
          
        </div>
      

      
        
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/2017/02/26/blog_mickeyzzc/" rel="next" title="GitHub博客的搭建（docker-hexo）">
                <i class="fa fa-chevron-left"></i> GitHub博客的搭建（docker-hexo）
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/2016/08/11/zsh-tmux-vim-git/" rel="prev" title="Tumx + Git + OhMyZsh + VIM">
                Tumx + Git + OhMyZsh + VIM <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </article>



    <div class="post-spread">
      
    </div>
  </div>


          </div>
          


          
  <div class="comments" id="comments">
    
      <div class="ds-thread" data-thread-key="2017/01/20/mi-docker-net/"
           data-title="跨城区局域网的搭建（基于Docker）" data-url="https://blog.mickeyzzc.tech/2017/01/20/mi-docker-net/">
      </div>
    
  </div>


        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap" >
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview">
            站点概览
          </li>
        </ul>
      

      <section class="site-overview sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
          <img class="site-author-image" itemprop="image"
               src="/images/avatar.gif"
               alt="蓝宝石的傻话" />
          <p class="site-author-name" itemprop="name">蓝宝石的傻话</p>
           
              <p class="site-description motion-element" itemprop="description"></p>
           
        </div>
        <nav class="site-state motion-element">

          
            <div class="site-state-item site-state-posts">
              <a href="/archives">
                <span class="site-state-item-count">8</span>
                <span class="site-state-item-name">日志</span>
              </a>
            </div>
          

          
            
            
            <div class="site-state-item site-state-categories">
              <a href="/categories/index.html">
                <span class="site-state-item-count">6</span>
                <span class="site-state-item-name">分类</span>
              </a>
            </div>
          

          
            
            
            <div class="site-state-item site-state-tags">
              <a href="/tags/index.html">
                <span class="site-state-item-count">13</span>
                <span class="site-state-item-name">标签</span>
              </a>
            </div>
          

        </nav>

        

        <div class="links-of-author motion-element">
          
            
              <span class="links-of-author-item">
                <a href="https://git.mickeybee.cn" target="_blank" title="MiGIT">
                  
                    <i class="fa fa-fw fa-globe"></i>
                  
                  MiGIT
                </a>
              </span>
            
              <span class="links-of-author-item">
                <a href="https://github.com/mickeyzzc" target="_blank" title="GITHUB">
                  
                    <i class="fa fa-fw fa-globe"></i>
                  
                  GITHUB
                </a>
              </span>
            
          
        </div>

        
        

        
        

        


      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-3"><a class="nav-link" href="#概述："><span class="nav-number">1.</span> <span class="nav-text">概述：</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#概念图："><span class="nav-number">2.</span> <span class="nav-text">概念图：</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#具体流程："><span class="nav-number">3.</span> <span class="nav-text">具体流程：</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#购买云服务器部署docker"><span class="nav-number">3.1.</span> <span class="nav-text">购买云服务器部署docker</span></a><ol class="nav-child"><li class="nav-item nav-level-5"><a class="nav-link" href="#外挂存储格式化为xfs分区"><span class="nav-number">3.1.1.</span> <span class="nav-text">外挂存储格式化为xfs分区;</span></a></li><li class="nav-item nav-level-5"><a class="nav-link" href="#调整docker的目录-两种方法"><span class="nav-number">3.1.2.</span> <span class="nav-text">调整docker的目录,两种方法;</span></a></li></ol></li><li class="nav-item nav-level-4"><a class="nav-link" href="#安装docker-openvpn服务"><span class="nav-number">3.2.</span> <span class="nav-text">安装docker-openvpn服务:</span></a><ol class="nav-child"><li class="nav-item nav-level-5"><a class="nav-link" href="#Pick-a-name-for-the-OVPN-DATA-data-volume-container-it-will-be-created-automatically"><span class="nav-number">3.2.1.</span> <span class="nav-text">Pick a name for the $OVPN_DATA data volume container, it will be created automatically.</span></a></li><li class="nav-item nav-level-5"><a class="nav-link" href="#Initialize-the-OVPN-DATA-container-that-will-hold-the-configuration-files-and-certificates"><span class="nav-number">3.2.2.</span> <span class="nav-text">Initialize the $OVPN_DATA container that will hold the configuration files and certificates</span></a></li><li class="nav-item nav-level-5"><a class="nav-link" href="#Start-OpenVPN-server-process"><span class="nav-number">3.2.3.</span> <span class="nav-text">Start OpenVPN server process</span></a></li><li class="nav-item nav-level-5"><a class="nav-link" href="#Generate-a-client-certificate-without-a-passphrase"><span class="nav-number">3.2.4.</span> <span class="nav-text">Generate a client certificate without a passphrase .</span></a></li><li class="nav-item nav-level-5"><a class="nav-link" href="#增加路由规则"><span class="nav-number">3.2.5.</span> <span class="nav-text">增加路由规则</span></a></li><li class="nav-item nav-level-5"><a class="nav-link" href="#给客户端配置静态内外IP。"><span class="nav-number">3.2.6.</span> <span class="nav-text">给客户端配置静态内外IP。</span></a></li></ol></li><li class="nav-item nav-level-4"><a class="nav-link" href="#部署前端代理"><span class="nav-number">3.3.</span> <span class="nav-text">部署前端代理</span></a><ol class="nav-child"><li class="nav-item nav-level-5"><a class="nav-link" href="#选择DOCKER-CADDY做反向代理"><span class="nav-number">3.3.1.</span> <span class="nav-text">选择DOCKER-CADDY做反向代理:</span></a></li><li class="nav-item nav-level-5"><a class="nav-link" href="#CADDY的配置参考："><span class="nav-number">3.3.2.</span> <span class="nav-text">CADDY的配置参考：</span></a></li></ol></li><li class="nav-item nav-level-4"><a class="nav-link" href="#部署TCP代理"><span class="nav-number">3.4.</span> <span class="nav-text">部署TCP代理</span></a><ol class="nav-child"><li class="nav-item nav-level-5"><a class="nav-link" href="#选择DOCKER-HAPROXY并部署"><span class="nav-number">3.4.1.</span> <span class="nav-text">选择DOCKER-HAPROXY并部署:</span></a></li></ol></li><li class="nav-item nav-level-4"><a class="nav-link" href="#映射后端端口。"><span class="nav-number">3.5.</span> <span class="nav-text">映射后端端口。</span></a></li></ol></li></ol></div>
            

          </div>
        </section>
      <!--/noindex-->
      

      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright" >
  
  &copy;  2016 - 
  <span itemprop="copyrightYear">2017</span>
  <span class="with-love">
    <i class="fa fa-MickeyZZC"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">蓝宝石的傻话</span>
</div>


<div class="powered-by">
  由 <a class="theme-link" href="https://hexo.io">Hexo</a> 强力驱动
</div>

<div class="theme-info">
  主题 -
  <a class="theme-link" href="https://github.com/iissnan/hexo-theme-next">
    NexT.Mist
  </a>
</div>


        

        
      </div>
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
      </div>
    

  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  












  
  <script type="text/javascript" src="/lib/jquery/index.js?v=2.1.3"></script>

  
  <script type="text/javascript" src="/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>

  
  <script type="text/javascript" src="/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>

  
  <script type="text/javascript" src="/lib/velocity/velocity.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>


  


  <script type="text/javascript" src="/js/src/utils.js?v=5.1.0"></script>

  <script type="text/javascript" src="/js/src/motion.js?v=5.1.0"></script>



  
  

  
  <script type="text/javascript" src="/js/src/scrollspy.js?v=5.1.0"></script>
<script type="text/javascript" src="/js/src/post-details.js?v=5.1.0"></script>



  


  <script type="text/javascript" src="/js/src/bootstrap.js?v=5.1.0"></script>



  

  
    
  

  <script type="text/javascript">
    var duoshuoQuery = {short_name:"mickeyzzc"};
    (function() {
      var ds = document.createElement('script');
      ds.type = 'text/javascript';ds.async = true;
      ds.id = 'duoshuo-script';
      ds.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') + '//static.duoshuo.com/embed.js';
      ds.charset = 'UTF-8';
      (document.getElementsByTagName('head')[0]
      || document.getElementsByTagName('body')[0]).appendChild(ds);
    })();
  </script>

  
















  





  

  

  

  

  

</body>
</html>
